home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 2.iso / toolbox / public / figlet / util / fsfiglet < prev    next >
Text File  |  1996-11-11  |  1KB  |  50 lines

  1. #!/usr/bin/perl
  2.  
  3. # fsfiglet -- font switching front end to figlet
  4. #
  5. # Copyright Daniel Simmons and Idaho State University 1993.
  6. # Permission is here by granted to use fsfiglet and modify figlet without
  7. # cost.
  8. #
  9. # USAGE:
  10. #
  11. #      fsfiglet [-p] [-c] file file ...
  12. #      | fsfiglet [-p] [-c]
  13. #
  14. # The -p and -c options (if specified) are just passed on to figlet.
  15. # The input will default to the standard font, but you may switch
  16. # fonts anywhere along the way by inserting a line of the format:
  17. #
  18. #      %% <fontname>
  19. #
  20. # (The %% must be at the beginning of a line.)
  21.  
  22. require "getopts.pl";
  23. &Getopts('pc');
  24. $args .= " -p" if $opt_p;
  25. $args .= " -c" if $opt_c;
  26.  
  27. $line = 0;
  28. $font[1] = "standard";
  29.  
  30. while (<>)
  31. {
  32.     if (/^%%\s+(\S+)\s*$/)
  33.     {
  34.         $line++;
  35.         $font[$line] = $1;
  36.     }
  37.     else
  38.     {
  39.         $line++ if $line == 0;
  40.         $text[$line] .= $_;
  41.     }
  42. }
  43.  
  44. for ($i = 1; $i <= $line; $i++)
  45. {
  46.     open (FIGLET, "|figlet $args -f $font[$i]");
  47.     print FIGLET $text[$i];
  48.     close (FIGLET);
  49. }
  50.